package com.dfdchem.imd.kaiwu.adapter;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentStatePagerAdapter;

import java.util.List;


public class MainPageAdapter extends FragmentStatePagerAdapter {

    // 界面列表
    private List<Fragment> fragments;

    public MainPageAdapter(FragmentManager manager, List<Fragment> fragments) {
        super(manager,FragmentStatePagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);

        this.fragments = fragments;
    }

    @Override
    public Fragment getItem(int position) {

        return fragments == null ? null : fragments.get(position);
    }

    @Override
    public int getCount() {

        return fragments == null ? 0 : fragments.size();
    }
}
